<?php

namespace api\libs\event\models;


use Yii;
use yii\db\ActiveRecord;


/**
 * This is the model class for table "event".
 *
 * @property integer $id
 * @property string $name
 * @property integer $type
 * @property string $description
 * @property integer $valid
 * @property integer $visible
 */
class Event extends \yii\db\ActiveRecord
{
    
    CONST STATUS_VALID = 1;
    CONST STATUS_INVALID = 0;
    CONST VISIBLE_VALID = 1;
    CONST VISIBLE_INVALID = 0;
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'event';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['name', 'description', 'valid', 'visible'], 'required'],
            [['type', 'valid', 'visible'], 'integer'],
            [['name'], 'string', 'max' => 64],
            [['description'], 'string', 'max' => 255],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'name' => 'Name',
            'type' => 'Type',
            'description' => 'Description',
            'valid' => 'Valid',
            'visible' => 'Visible',
        ];
    }
    
        public static function getStatusOptions() {
        return array(
            self::STATUS_VALID => '开通',
            self::STATUS_INVALID => '禁用',
        );
    }

    public static function getVisibleOptions() {
        return array(
            self::VISIBLE_VALID => '显示',
            self::VISIBLE_INVALID => '隐藏',
        );
    }
}

